<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Edit_page</title>
</head>
<body>
<form action="{% url 'blog:edit_action' %} "method="post">
   {% csrf_token %}

    <input type="hidden" name="article_id"  id="modify_id" value="{{ article.id | default:'0'}}">
    <label>文章标题
   <input type="text" name="title" id="modify_title" value="{{  article.title}} ">
    </label><br>

    <label>文章内容
   <input type="text" name="content" id="modify_content" value="{{  article.content}}">
    </label><br>
{#<button type="button" id="close">Close</button>#}
<button type="submit" id="submit" value="提交" ></button>
</form>

<script>
    $('#submit').click(function(){
        var data = [];
        data['csrfmiddlewaretoken'] = $('#csrftoken').val();
        data['id'] = $('#modify_id').val();
        data['title'] = $('#modify_title').val();
        data['content'] = $('#modify_content').val();
        console.log(data)
        $.post('/',data,function (res) {
            $('#close').click()

        })
    }

</script>
</body>


</html>